**************************************************************/
*This do file creates the licensure variables to merge in for the main analysis;
**************************************************************/

capture log close
capture program drop _all
capture macro drop _all
estimates drop _all
set matsize 1000
drop _all
set more off

*UPDATE PATHS;
global quality 

#delimit ;
**************************************************************;
use "${quality}qual_appended_geo.dta", clear;

*Cleaning up province codes;
*Metro Manila is all treated as one province (labeled as third district, but that is arbitrary);
replace province="THIRD DISTRICT" if province=="FIRST DISTRICT"	;				
replace province="THIRD DISTRICT" if province=="SECOND DISTRICT";			
replace province="THIRD DISTRICT" if province=="FOURTH DISTRICT";
*Reassign to original provinces before provincial divisons;
replace province="ZAMBOANGA DEL SUR" if province=="ZAMBOANGA SIBUGAY";											
replace province="SURIGAO DEL NORTE" if province=="DINAGAT ISLANDS";
*SULU AND TAWI-TAWI ARE DROPPED;
drop if province=="SULU"|province=="TAWI-TAWI";

*COLLAPSE TO PROVINCE-YEAR LEVEL;
collapse (sum) examine* cond* failed* passed*, by(year province);

gen pass_rate=passed/examinees;
gen pass_rate_ft=passed_ft/examinees_ft;
gen pass_rate_rep=passed_rep/examinees_rep;

label variable pass_rate "Nursing Licensure Pass Rate"; 
label variable pass_rate_ft "Nursing Licensure Pass Rate, First Time (2008 onward)";
label variable pass_rate_rep "Nursing Licensure Pass Rate, Repeater (2008 onward)";

*Use this to merge with nursing data;
save "${quality}quality_province_year.dta", replace;





